@extends('admin.layout.layout')
@section('content')



@component('admin.components.content.formContent')
@slot('rightContent')
<form class="form-material mini-form ajaxForm" method="POST" @if(isset($editData)) action="{{url('/admin/admin',['id'=>$editData->id])}}" @else action="{{url('/admin/admin')}}" @endif)>
    @isset($editData)
        @method('PUT')
    @endisset
    @csrf
    <div class="body">
        @component('admin.components.photoUpload',[
            'title'=>'头像',
            'name'=>'avatar',
            'pos'=>'center',
            'default'=>isset($editData)?$editData->avatar:''
            ])
        @endcomponent
        @if (!isset($editData))
            @component('admin.components.input',[
                'min'=>'6',
                'title'=>'用户名',
                'name'=>'account',
                'default'=>isset($editData)?$editData->account:''
                ])
            @endcomponent
        @endif

        @component('admin.components.input',[
            'title'=>'昵称',
            'name'=>'nickname',
            'holder'=>'请输入昵称',
            'default'=>isset($editData)?$editData->nickname:'',
            'required'=>'no'
            ])
        @endcomponent
        
        @if (!isset($editData))
            @component('admin.components.input',[
                'min'=>'6',
                'title'=>'密码',
                'name'=>'password',
                'holder'=>'请输入密码'
                ])
            @endcomponent
        @endisset
            
        
        <h6>角色权限</h6>
        <select name="role_id" class="form-control mt-2 mb-3">
            @foreach ($roleList as $item)
                <option @if(isset($editData)&&$editData->role_id==$item->id) selected @endif value="{{$item->id}}">{{$item->role_name}}</option>
            @endforeach
        </select>

        @component('admin.components.input',[
            'title'=>'排序',
            'name'=>'sort',
            'holder'=>'请输入排序',
            'default'=>isset($editData)?$editData->sort:100,
            'required'=>'no'])
        @endcomponent

    </div>
    <button type="submit" class="btn btn-primary mt-2"><i class="icon-arrow_forward mr-2"></i>提交</button>
</form>
@endslot
@endcomponent


 
@endsection